package com.elong.businesstravel.base.umeng.socialize.adapter;

import java.util.Collections;
import java.util.List;

import com.elong.businesstravel.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class CustomShareAdapter extends BaseAdapter {

	private Context mContext;
	private Integer[] mImageIntegers;
	private String[] mNameStrings;

	public CustomShareAdapter(Context context, Integer[] imageId, String[] nameStrings) {
		mContext = context;
		mImageIntegers = imageId;
		mNameStrings = nameStrings;
	}

	@Override
	public int getCount() {
		return mNameStrings.length;
	}

	@Override
	public Object getItem(int arg0) {
		return mNameStrings[arg0];
	}

	@Override
	public long getItemId(int arg0) {
		return arg0;
	}

	@Override
	public View getView(int arg0, View arg1, ViewGroup arg2) {

		if (null == arg1) {
			arg1 = LayoutInflater.from(mContext).inflate(
					R.layout.adapter_share, null);
		}
		arg1.setTag(mImageIntegers[arg0]);
		ImageView shareImageView = (ImageView) arg1
				.findViewById(R.id.shareImageView);
		shareImageView.setImageResource(mImageIntegers[arg0]);
		
		TextView shareNameTextView = (TextView) arg1
				.findViewById(R.id.shareNameTextView);
		shareNameTextView.setText(mNameStrings[arg0]);

		return arg1;
	}

}
